package com.demo.crm.springboot3security.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;

/**
 * 数据库表定义
 */
public class Tables {
    public static final CustomFormTableDef CUSTOM_FORM = new CustomFormTableDef();
    public static final FormFieldTableDef FORM_FIELD = new FormFieldTableDef();
    public static final FormRelationTableDef FORM_RELATION = new FormRelationTableDef();
    public static final ModuleTableDef MODULE = new ModuleTableDef();
    public static final PermissionTableDef PERMISSION = new PermissionTableDef();
    public static final RoleTableDef ROLE = new RoleTableDef();
    public static final UserTableDef USER = new UserTableDef();

    public static class CustomFormTableDef extends TableDef {
        public final QueryColumn ID = new QueryColumn(this, "id");
        public final QueryColumn CODE = new QueryColumn(this, "code");
        public final QueryColumn NAME = new QueryColumn(this, "name");
        public final QueryColumn LAYOUT_CONFIG = new QueryColumn(this, "layout_config");
        public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
        public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

        public CustomFormTableDef() {
            super("custom_form", "", "custom_form");
        }
    }

    public static class FormFieldTableDef extends TableDef {
        public final QueryColumn ID = new QueryColumn(this, "id");
        public final QueryColumn FORM_ID = new QueryColumn(this, "form_id");
        public final QueryColumn NAME = new QueryColumn(this, "name");
        public final QueryColumn CODE = new QueryColumn(this, "code");
        public final QueryColumn TYPE = new QueryColumn(this, "type");
        public final QueryColumn LABEL = new QueryColumn(this, "label");
        public final QueryColumn PLACEHOLDER = new QueryColumn(this, "placeholder");
        public final QueryColumn OPTIONS = new QueryColumn(this, "options");
        public final QueryColumn REQUIRED = new QueryColumn(this, "required");
        public final QueryColumn VALIDATION = new QueryColumn(this, "validation");
        public final QueryColumn ORDER_NUM = new QueryColumn(this, "order_num");
        public final QueryColumn DEFAULT_VALUE = new QueryColumn(this, "default_value");
        public final QueryColumn HELP_TEXT = new QueryColumn(this, "help_text");
        public final QueryColumn STYLE_CONFIG = new QueryColumn(this, "style_config");
        public final QueryColumn CREATED_AT = new QueryColumn(this, "created_at");
        public final QueryColumn UPDATED_AT = new QueryColumn(this, "updated_at");

        public FormFieldTableDef() {
            super("form_fields", "", "form_fields");
        }
    }

    public static class FormRelationTableDef extends TableDef {
        public final QueryColumn ID = new QueryColumn(this, "id");
        public final QueryColumn FORM_ID = new QueryColumn(this, "form_id");
        public final QueryColumn RELATED_FORM_ID = new QueryColumn(this, "related_form_id");
        public final QueryColumn RELATION_TYPE = new QueryColumn(this, "relation_type");
        public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
        public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

        public FormRelationTableDef() {
            super("form_relation", "", "form_relation");
        }
    }

    public static class ModuleTableDef extends TableDef {
        public final QueryColumn ID = new QueryColumn(this, "id");
        public final QueryColumn NAME = new QueryColumn(this, "name");
        public final QueryColumn CODE = new QueryColumn(this, "code");
        public final QueryColumn PARENT_ID = new QueryColumn(this, "parent_id");
        public final QueryColumn PATH = new QueryColumn(this, "path");
        public final QueryColumn ICON = new QueryColumn(this, "icon");
        public final QueryColumn SORT = new QueryColumn(this, "sort");
        public final QueryColumn STATUS = new QueryColumn(this, "status");
        public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
        public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

        public ModuleTableDef() {
            super("module", "", "module");
        }
    }

    public static class PermissionTableDef extends TableDef {
        public final QueryColumn ID = new QueryColumn(this, "id");
        public final QueryColumn NAME = new QueryColumn(this, "name");
        public final QueryColumn KEY = new QueryColumn(this, "permission_key");
        public final QueryColumn URL = new QueryColumn(this, "url");
        public final QueryColumn METHOD = new QueryColumn(this, "method");
        public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
        public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

        public PermissionTableDef() {
            super("permission", "", "permission");
        }
    }

    public static class RoleTableDef extends TableDef {
        public final QueryColumn ID = new QueryColumn(this, "id");
        public final QueryColumn NAME = new QueryColumn(this, "name");
        public final QueryColumn CODE = new QueryColumn(this, "code");
        public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
        public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

        public RoleTableDef() {
            super("role", "", "role");
        }
    }

    public static class UserTableDef extends TableDef {
        public final QueryColumn ID = new QueryColumn(this, "id");
        public final QueryColumn USERNAME = new QueryColumn(this, "username");
        public final QueryColumn PASSWORD = new QueryColumn(this, "password");
        public final QueryColumn EMAIL = new QueryColumn(this, "email");
        public final QueryColumn PHONE = new QueryColumn(this, "phone");
        public final QueryColumn STATUS = new QueryColumn(this, "status");
        public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
        public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

        public UserTableDef() {
            super("user", "", "user");
        }
    }
}